package org.emet.entity.storage;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.emet.jee.console.entity.BaseEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 物品
 * 
 * @author alex
 * 
 */
@Entity
@Table(name = "T_ITEM")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Item extends BaseEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String code;
	/** 收费项目名称 */
	private String name;
	/** 计量单位 */
	private String unit;
	/** 参考单价 */
	private BigDecimal price = new BigDecimal(0.00);
	/** 成本总额 */
	private BigDecimal totalCost = new BigDecimal(0.00);
	/**
	 * 加权价
	 */
	private BigDecimal weightPrice = new BigDecimal(0.00);
	/**
	 * 库存数量
	 */
	private int stockQuatity;
	/** 备注 */
	private String remark;

	@Column(nullable = false)
	public BigDecimal getTotalCost() {
		return totalCost;
	}

	public void setTotalCost(BigDecimal totalCost) {
		this.totalCost = totalCost;
	}

	@Column(nullable = false)
	public int getStockQuatity() {
		return stockQuatity;
	}

	public void setStockQuatity(int stockQuatity) {
		this.stockQuatity = stockQuatity;
	}

	@Column(nullable = false)
	public BigDecimal getWeightPrice() {
		return weightPrice;
	}

	public void setWeightPrice(BigDecimal weightPrice) {
		this.weightPrice = weightPrice;
	}

	@Column(nullable = false, unique = true)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(nullable = false)
	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	@Column(nullable = false)
	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	@Column(unique = true)
	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
